package com.huawei.csi.tool.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author lxw
 */
public class TimeUtil {
    /**
     * DATE_FORMAT_THREAD_LOCAL
     */
    private static final ThreadLocal<SimpleDateFormat> DATE_FORMAT_THREAD_LOCAL = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));

    /***
     * formatTimestamp
     *
     * @param timestamp timestamp
     * @return java.lang.String
     **/
    public static String formatTimestamp(long timestamp) {
        return DATE_FORMAT_THREAD_LOCAL.get().format(new Date(timestamp));
    }
}
